package cn.fzm.ssm.dao;

import cn.fzm.ssm.domain.Permission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Dremeue
 * @create 2019-10-12 17:09
 **/
public interface IPermissionDao {

    @Select("select * from permission where id in (select permissionId from role_permission where roleId = #{roleId})")
    public List<Permission> findByRoleId(String roleId);

    @Select("select * from permission")
    public List<Permission> findAll();

    @Insert("insert into permission(id, permissionName, url) values(#{id}, #{permissionName}, #{url})")
    public void save(Permission permission);

    @Select("select * from permission where id not in (select permissionId from role_permission where roleId = #{roleId})")
    public List<Permission> findOtherPermission(String roleId);
}
